const data = require("./a.js");
// import { data } from "./a.js";
var treeData = data.RECORDS;

var hashMap = {};
for (var i = 0; i < treeData.length; i++) {
  hashMap[treeData[i].id] = treeData[i];
}
var result = [];
for (var key in hashMap) {
  var item = hashMap[key];
  if (item.pid === "0") {
    result.push(item);
  } else {
    var parent = hashMap[item.pid];
    if (!parent.children) {
      parent.children = [];
    }
    parent.children.push(item);
  }
}
module.exports = result;
